Returns 1 if the password of the user or computer account has expired.
#Include <AD.au3>
_AD_IsPasswordExpired([$sAccount = @Username])
Parameters
| $sAccount | Optional: User or computer account to check (default = @Username). Can be specified as Fully Qualified Domain Name (FQDN) or sAMAccountName |
Return Value
Success: 1, The password of the specified account has expired
Remarks
None.
Related
_AD_GetPasswordExpired, _AD_GetPasswordDontExpire, _AD_SetPassword, _AD_DisablePasswordExpire, _AD_EnablePasswordExpire, _AD_EnablePasswordChange, _AD_DisablePasswordChange, _AD_GetPasswordInfo
Example
#AutoIt3Wrapper_AU3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#AutoIt3Wrapper_AU3Check_Stop_OnWarning=Y
#include <AD.au3>
; Open Connection to the Active Directory
_AD_Open()
If @error Then Exit MsgBox(16, "Active Directory Example Skript", "Function _AD_Open encountered a problem. @error = " & @error & ", @extended = " & @extended)
; *****************************************************************************
; Example 1
; Checks if the password for the current user is expired.
; *****************************************************************************
If _AD_IsPasswordExpired() Then
MsgBox(64, "Active Directory Functions", "Password for user '" & @UserName & "' has expired")
Else
MsgBox(64, "Active Directory Functions", "Password for user '" & @UserName & "' has not expired")
EndIf
; *****************************************************************************
; Example 2
; Get a list of accounts for which the password has expired and check the first entry
; *****************************************************************************
Global $aExpired = _AD_GetPasswordExpired()
If @error = 0 Then
Global $sUser = _AD_FQDNToSamAccountName($aExpired[1])
If _AD_IsPasswordExpired($sUser) Then
MsgBox(64, "Active Directory Functions", "Password for user '" & $sUser & "' has expired")
Else
MsgBox(64, "Active Directory Functions", "Password for user '" & $sUser & "' has not expired")
EndIf
Else
MsgBox(64, "Active Directory Functions", "No expired user passwords found")
EndIf
; Close Connection to the Active Directory
_AD_Close()